#include <2025Linux.h>
int main(int argc, char *argv[])
{
    int fds[2];
    pipe(fds);
    if(fork()){
        close(fds[1]);
        close(fds[0]);//父进程关闭读端
        int wstatus;
        wait(&wstatus);
        if(WIFEXITED(wstatus)){
            printf("exit!\n");
        }
        else if(WIFSIGNALED(wstatus)){
            printf("signum = %d\n", WTERMSIG(wstatus));
        }
    }
    else{
        close(fds[0]);//子进程也关闭读端
        sleep(5);
        printf("sleep over!\n");
        ssize_t ret = write(fds[1],"hello",5);
        printf("ret = %ld\n", ret);
        exit(0);
    }
    return 0;
}

